package com.AJava1710D.设计模式.责任链模式.MyFilter;

import java.util.Vector;

/**
 * 作者: LCG
 * 日期: 2020/6/30 08:57
 * 描述:
 */
public class My00FilterChainImpl implements My00FilterChain {

    private Vector<My00Filter> vector=new Vector<>();

    @Override
    public void register(My00Filter my00Filter){
        vector.add(my00Filter);
    }

    private int nextChain=0;

    @Override
    public void chain() {

        if(nextChain<vector.size()){
            My00Filter my00Filter = vector.get(nextChain);
            nextChain++;
            my00Filter.doFilter(this);

        }

    }
}
